<div class="content">
    
    
     <%=form_remote_tag(:url=>{:controller=>"user_notification", :action=>"send_emails"}, :loading=>"post_mailer.showEmaillingWaiting()",:complete=>"post_mailer.completedEmailling()")%> 
    <div>O teu email</div>
    
    <input onfocus="post_mailer.clearEmailValue()" onblur="post_mailer.onLostFocusEmailValue()" value="<%=@my_email%>" tabindex=1 type="text" name="my_email" size="50" maxlength="256" id="my_email" style="border:solid 1px #cccccc"/>
    
     
    <div>Introduz os email(s) para quem queres enviar isto. <span class="tip">Separados por virgulas!</span></div>
    <textarea tabindex=2 wrap="hard" name="email_content" id="email_content" cols=80" rows="3" <%if session[:logged_user]%> onkeyup="post_mailer.showEmails(event,this)"<%else%>onkeyup="post_mailer.validateWhenNotLogged(this)"<%end%>/></textarea> <br/>
    
    <div id="autosearch_email">&nbsp;</div>
    <%= submit_tag "Enviar", {:class=>"focus", :title=>"enviar mensagens",:id=>"send_email_button", :disabled=>"disabled",:tabindex=>"2"}%>
    
    <input id="cancel" type="button" value="Cancelar" title="cancelar" onclick="post_mailer.closeWindow()"/> 
    <input type="hidden" name="post_id" id="post_id" value="<%=@post_id%>"/>
    
       
   <%=end_form_tag%>

</div>

<script type="text/javascript">
//<![CDATA[
    
    
    <%
    contacts = ""
    counter = 0 
    
    @user_contacts.each do |ct|
        counter +=1
        contacts << "'#{ct[:contact_key]}'"
        contacts << ":"
        contacts << "'#{ct[:email]}'"
        if counter < @user_contacts.size() 
            contacts << ","
        end
    end%>
    //alert("<%=contacts%>");
    emails_suggestions.setContacts($H({<%=contacts%>})); 
    txtEl = $('email_content');
    window.setTimeout(" $('email_content').focus()",200);
//    txtEl.focus();
    
 //]]>
</script>
